<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>买家修改页面</title>
    <link rel="stylesheet" href="../js/bootstrap3/css/bootstrap.min.css">
    <link rel="stylesheet" href="../js/bootstrap-treeview/bootstrap-treeview.min.css">
    <link rel="stylesheet" href="../js/bootStrap-addTabs/bootstrap.addtabs.css">
    <link rel="stylesheet" href="../js/bootstrap-table/bootstrap-table.min.css">
    <link rel="stylesheet" href="../js/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css">
    <link rel="stylesheet" href="../js/bootstrap-fileinput/css/fileinput.min.css">
    <link rel="stylesheet" href="../js/kindeditor-4.1.10/themes/default/default.css"/>
</head>
<script type="text/javascript" src="../js/jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="../js/bootstrap3/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../js/bootstrap-treeview/bootstrap-treeview.min.js"></script>
<script type="text/javascript" src="../js/bootStrap-addTabs/bootstrap.addtabs.min.js"></script>
<script type="text/javascript" src="../js/bootstrap-table/bootstrap-table.min.js"></script>
<script type="text/javascript" src="../js/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script type="text/javascript" src="../js/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="../js/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
<script type="text/javascript" src="../js/bootstrap-bootbox/bootbox.js"></script>
<script type="text/javascript" src="../js/bootstrap-fileinput/js/fileinput.min.js"></script>
<script type="text/javascript" src="../js/bootstrap-fileinput/js/locales/zh.js"></script>
<script type="text/javascript" src="../js/kindeditor-4.1.10/kindeditor-all.js"></script>
<body>

<!-- container-fluid 流式布局 -->
<div class="container-fluid">
    <form id="updateForm" class="form-horizontal">
        <input type="hidden" name="guanggaoid" th:value="${guanggao.guanggaoid}"/>
        <div class="row">
            <h3 th:if="${guanggao.guanggaoid==1}">轮播广告一号位</h3>
            <h3 th:if="${guanggao.guanggaoid==2}">轮播广告二号位</h3>
            <div class="col-xs-12">
                <input type="hidden" id="testimg" name="guanggaoimg" />
                <input type="file" multiple class="projectfile" accept="image/*" name="img" id="fileImg">
            </div>
        </div>
    </form>
</div>

</body>
<script type="text/javascript">

    //广告上传
    $('#fileImg').fileinput({	//加载文件
        language: 'zh', //设置语言
        uploadUrl: '../file/uploadFiles', //文件要上传的路径、地址
        allowedFileExtensions: ['jpg', 'gif', 'png'],	//后台能接收的文件类型
        showUpload: true, //是否显示上传按钮
        showCaption: false,//是否显示标题
        browseClass: "btn btn-success", //按钮样式--颜色  btn btn-danger 红色	btn btn-primary 蓝色	btn btn-success 绿色	btn btn-info 浅蓝
        dropZoneEnabled: true,//是否显示拖拽区域
        //minImageWidth: 50, //图片的最小宽度
        //minImageHeight: 50,//图片的最小高度
        //maxImageWidth: 1000,//图片的最大宽度
        //maxImageHeight: 1000,//图片的最大高度
        maxFileSize: 0,//限制上传文件大小，单位为kb，如果为0表示不限制文件大小
        //minFileCount: 0,
        maxFileCount: 1, //表示允许同时上传的最大文件个数
        enctype: 'multipart/form-data',
        validateInitialCount:true,
        previewFileIcon: "<i class='glyphicon glyphicon-king'></i>",	//？？？
        msgFilesTooMany: "选择上传的文件数量({n}) 超过允许的最大数值{m}！",

    }).on('fileuploaded', function(event, data, previewId, index) {	//上传后的回填
        var imgval = $('#testimg').val();
        if(imgval == null || imgval == "" || imgval == undefined){
            var path1 = data.response.img+"";
            imgval = path1.substring(15);
        }else{
            var path1 = data.response.img+"";
            imgval = path1.substring(15);
        }
        $('#testimg').val(imgval);
    });


</script>
</html>